package com.luber.backstage.service.impl;

import java.util.List;

import com.luber.backstage.domain.EticketStation;
import com.luber.backstage.mapper.EticketRouteMapper;
import com.luber.backstage.mapper.EticketStationMapper;
import com.luber.backstage.service.IEticketStationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author luber
 * @date 2021-01-31
 */
@Service
public class EticketStationServiceImpl implements IEticketStationService
{
    @Autowired
    private EticketStationMapper eticketStationMapper;
    @Autowired
    private EticketRouteMapper eticketRouteMapper;

    /**
     * 查询【请填写功能名称】
     *
     * @param id 【请填写功能名称】ID
     * @return 【请填写功能名称】
     */
    @Override
    public EticketStation selectEticketStationById(Long id)
    {
        return eticketStationMapper.selectEticketStationById(id);
    }

    /**
     * 查询【请填写功能名称】列表
     *
     * @param eticketStation 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<EticketStation> selectEticketStationList(EticketStation eticketStation)
    {
        return eticketStationMapper.selectEticketStationList(eticketStation);
    }

    /**
     * 新增【请填写功能名称】
     *
     * @param eticketStation 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertEticketStation(EticketStation eticketStation)
    {
        return eticketStationMapper.insertEticketStation(eticketStation);
    }

    /**
     * 修改【请填写功能名称】
     *
     * @param eticketStation 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateEticketStation(EticketStation eticketStation)
    {
        return eticketStationMapper.updateEticketStation(eticketStation);
    }

    /**
     * 批量删除【请填写功能名称】
     *
     * @param ids 需要删除的【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteEticketStationByIds(Long[] ids)
    {
        return eticketStationMapper.deleteEticketStationByIds(ids);
    }

    /**
     * 删除【请填写功能名称】信息
     *
     * @param id 【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteEticketStationById(Long id)
    {
        return eticketStationMapper.deleteEticketStationById(id);
    }

    @Override
    public int insertListEticketStation(List<EticketStation> list) {
        int val = 0;
        Long id = eticketRouteMapper.getMaxCreateDateEticketRoute().getId();
        for (EticketStation eticketStation : list) {
            eticketStation.setRouteId(id);
            val = insertEticketStation(eticketStation);
        }
        return val;
    }
}
